import jwt
from backend.settings import SECRET_KEY


def get_user_info_from_token(request):
    """
    获取登录用户基本信息
    :param request:
    :return:
    """
    token = request.META.get("HTTP_AUTHORIZATION")
    token = token.split(" ")[1]
    verified_payload = jwt.decode(token, SECRET_KEY, algorithms=['HS256'])
    return verified_payload
